<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单列表')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="operlog-form">
                <div class="select-list">
                    <ul>
                        <li>
                            起始地：<select name="porCityId" th:with="cityList=${@dict.getCityCN()}" data-live-search="true" liveSearchStyle="contains"  class="selectpicker" >
                            <option value="">所有</option>
                            <option th:each="city : ${cityList}" th:text="${city.CITY_FULL_NAME_CN}" th:value="${city.UUID}"></option>
                        </select>
                        </li>
                        <li>
                            目的地：<select name="fndCityId" th:with="cityList=${@dict.getCity()}" data-live-search="true" liveSearchStyle="contains"  class="selectpicker" >
                            <option value="">所有</option>
                            <option th:each="city : ${cityList}" th:text="${city.CITY_FULL_NAME_EN}" th:value="${city.UUID}"></option>
                        </select>
                        </li>
                        <li>
                            执行类型：<select name="insertType">
                                <option value="">所有</option>
                                <option value="手动">手动</option>
                                <option value="定时">定时</option>
                            </select>
                        </li>
                        <li>
                            创建人：<input type="text" name="createBy"/>
                        </li>
                        <li>
                            联系方式：<input type="text" name="phonenumber"/>
                        </li>
                        <li>
                            产品类型：<select name="productType">
                            <option value="">全部</option>
                            <option value="普通产品">普通产品</option>
                            <option value="远期产品">远期产品</option>
                            <option value="冷藏冷箱">冷藏冷箱</option>
                            <option value="冷藏非冷箱">冷藏非冷箱</option>
                        </select>
                        </li>
                        <li>
                            确认状态：<select name="confirmStatus">
                            <option value="">全部</option>
                            <option value="未确认">未确认</option>
                            <option value="已确认">已确认</option>
                        </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="searchPre()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>


        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
    var prefix = ctx + "business/list";

    $(function() {
        var options = {
            url: prefix + "/list",
            modalName: "订单",
            queryParams: queryParams,
            columns: [{
                checkbox: true
            },{
                title: "序号",
                formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            },
                {
                    field: 'insertType',
                    title: '执行类型',
                    align: "center",
                },
                {
                    field: 'productType',
                    title: '产品类型',
                    align: "center",
                    formatter: function(value, row, index) {
                        return '<div style="width:100px;">'+value+'</div>';
                    }
                },
                {
                    field: 'porCityName',
                    title: '出发地(中文)',
                    align: "center"
                },
                {
                    field: 'fndCityName',
                    title: '目的地(中文)',
                    align: "center"
                },
                {
                    field: 'twentyGPCount',
                    title: '20GP数量',
                    align: "center"
                },
                {
                    field: 'fortyGPCount',
                    title: '40GP数量',
                    align: "center"
                },
                {
                    field: 'fortyHQCount',
                    title: '40HQ数量',
                    align: "center"
                },
                {
                    field: 'twentyRFCount',
                    title: '20RF数量',
                    align: "center"
                },{
                    field: 'fortyRQCount',
                    title: '40RQ数量',
                    align: "center"
                },
                {
                    field: 'orderNo',
                    title: '订单编号',
                    align: "center"
                },
                {
                    field: 'brNo',
                    title: '编号',
                    align: "center"
                },
                {
                    field: 'confirmStatus',
                    title: '确认状态',
                    align: "center"
                },
                {
                    field: 'email',
                    title: '邮箱',
                    align: "center"
                },
                {
                    field: 'phonenumber',
                    title: '联系方式',
                    align: "center"
                },
                {
                    field: 'subStatus',
                    title: '提交状态',
                    align: "center",
                    formatter: function(value, row, index) {
                        if(value == 0){
                            return '<div style="width:100px;">提交失败</div>';
                        }else if (value == 1){
                            return '<div style="width:100px;">提交成功</div>';
                        }else{
                            return '<div style="width:100px;">异常</div>';
                        }
                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    align: "center",
                    formatter: function(value, row, index) {
                       return '<div style="width:200px;">'+value+'</div>';
                    }
                },
                {
                    field: 'createBy',
                    title: '创建人',
                    align: "center"
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    align: "center",
                    formatter: function(value, row, index) {
                        return '<div style="width:150px;">'+value+'</div>';
                    }
                },]
        };
        $.table.init(options);
    });
    function queryParams(params) {
        var search = $.table.queryParams(params);
        return search;
    }

    function searchPre() {
        $.table.search('operlog-form', 'bootstrap-table');
    }

    function resetPre() {
        $("#operlog-form")[0].reset();
        $.table.search('operlog-form', 'bootstrap-table');
    }

    function add() {
        $.operate.add();
    }

</script>
</body>
</html>
